package refactoring.replaceSubclassWithDelegate;

import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * <描述>
 *
 * @author timothy.yang cloudwise
 * @since 2022-05-23 23:03
 */
@Data
@NoArgsConstructor
public class Bird {

    private String type;
    private String name;
    private String plumage;

    public Bird(BirdParam birdParam) {
        this.name = birdParam.getName();
        this.plumage = birdParam.getPlumage();
    }

    public static Bird createBird(BirdParam birdParam) {
        switch (birdParam.getType()) {
            case "EuropeanSwallow":
                return new EuropeanSwallow(birdParam);
            case "AfricanSwallow":
                return new AfricanSwallow(birdParam);
            case "NorwegianBlueParrot":
                return new NorweigianBlueParrot(birdParam);
            default:
                return new Bird();
        }
    }

    public String plumage() {
        return this.getPlumage();
    }

    public Integer airSpeedVelocity() {
        return null;
    }
}
